import type * as T from './type'
import http from '@/utils/http'
import type { LabelValueState } from '@/types/global'
const BASE_URL = '/system/channelPoint'
/** @desc 查询列表 */
export function listPage(query: T.ChannelPointQuery) {
  return http.get<PageRes<T.ChannelPointPageQuery[]>>(`${BASE_URL}/page`, query)
}

export function lists() {
  return http.get<T.ChannelPointDto[]>(`${BASE_URL}/list`)
}

export function channelPointSelect() {
  return http.get<LabelValueState[]>(`${BASE_URL}/getSelectList`)
}

/** @desc 查询详情 */
export function getChannelPoint(id: string) {
  return http.get<T.ChannelPointDto>(`${BASE_URL}/getData/${id}`)
}


/** @desc 新增 */
export function addObject(data: any) {
  return http.post(`${BASE_URL}/create`, data)
}


/** @desc 修改状态 */
export function updateStatus(data: any) {
  return http.post(`${BASE_URL}/updateStatus`, data)
}


/** @desc 修改 */
export function updateObject(data: any) {
  return http.post(`${BASE_URL}/modify`, data)
}

/** @desc 删除 */
export function deleteObject(ids: string | Array<string>) {
  return http.del(`${BASE_URL}/delete/${ids}`)
}


/** @desc 刷新緩存 */
export function refreshCache() {
  return http.get(`${BASE_URL}/refreshCache`)
}


/** @desc 下载导入模板 */
export function downloadUserImportTemplate() {
  return http.download(`${BASE_URL}/importTemplate`)
}


/** @desc 解析导入数据 */
export function importParse(data: any) {
  return http.post(`${BASE_URL}/importParse`, data)
}


/** @desc 导入 */
export function importChannelPoint(data: any) {
  return http.post(`${BASE_URL}/import`, data)
}

